Skip list find function does not work

Hello,
I was writing some code and used skip list. The find function does not work. Any ideas?
****************************************************************************************
{bool loadContent = false
Skip skpContents = createString()
void loadContents(void)
{
// Exception List file
string AdminFilename = "c:\\doorsinfo\\Admins.txt"

/* contents of file
hoqoqver
oraqqriu
kqwoch
aswwhley
anwadit1
anwadit1

*/

Stream strmAdmins = null
if(canOpenFile(AdminFilename , false)) // false is for read
{
strmAdmins= read AdminFilename
}
else
{
return false
}

while (true)
{
strmAdmins >> AdminFilename // read a line at a time
put(skpContents , AdminFilename"", "")
if(end of strmAdmins) break
}
}
bool excludeAdmins(string strAdminName)
{
bool blnAdmin = false
if(loadContent == false)
{
loadContents()
loadContent = true
}
string strAdminToChk = lower(strAdminName)

string str232
for str232 in skpContents do
{
print (string key skpContents) "\n"
}

print strAdminToChk "\n"
if(find(skpContents, strAdminToChk))
{
return true
}
else
{
return false
}
}

print excludeAdmins ("ppandit1") "\n"

  • out put ***********
hoqoqver
oraqqriu
kqwoch
aswwhley
anwadit1
anwadit1

fals
I should be getting true back

********************************
}
****************************************************************************************
jester76 - Mon Oct 15 18:12:15 EDT 2012

Re: Skip list find function does not work
SystemAdmin - Tue Oct 16 04:27:40 EDT 2012

Tested this on DOORS 9.4.0.1 and on this version it seems that the DOORS parser reads the line
 

print excludeAdmins ("ppandit1") "\n"

 

as

 

 

print excludeAdmins ("ppandit1\n")



which comes back as false. I removed the "\n" from the line at it worked fine (result was true).



 

 

 

  • Pekka Mäkinen - http://www.softqa.eu/

 

Re: Skip list find function does not work
SystemAdmin - Tue Oct 16 07:24:33 EDT 2012

SystemAdmin - Tue Oct 16 04:27:40 EDT 2012

Tested this on DOORS 9.4.0.1 and on this version it seems that the DOORS parser reads the line
 

print excludeAdmins ("ppandit1") "\n"

 

as

 

 

print excludeAdmins ("ppandit1\n")



which comes back as false. I removed the "\n" from the line at it worked fine (result was true).



 

 

 

  • Pekka Mäkinen - http://www.softqa.eu/

 

This has been the case with dxl for as long as I have been using it.
I always wrap functions in brackets to avoid this:

print((excludeAdmins("ppandit1")) "\n")

 


I guess the designers of dxl poorly implemented the optional brackets causing this mess.
Making them optional makes no sense to me. I suppose they whanted to mak it 'easier than c' so non-programmers could script it.
Now both programmers and non-programmers end up with hard to spot errors.
The designers of dxl really screwed this up!

Optional Brackets: What is this:

 

 

print foo bar "\n"



is foo a function or a variable?
is bar a function or a variable?
if foo is a function, how many arguments does it have?
if bar is a function, how many arguments does it have?
if foo is a function with 1 argument, what is passed to it?

same questions apply to "print", but we all know that one

Functions must have Brackets: What is this:



 

 

print(foo bar "\n")// foo and bar are variables
print(foo(bar "\n"))// foo is a function with 1 arg and bar is a variable
print(foo(bar(), "\n"))// foo is a function with 2 args and bar is a function with 0 args

 

Re: Skip list find function does not work
jester76 - Tue Oct 16 09:37:19 EDT 2012

SystemAdmin - Tue Oct 16 07:24:33 EDT 2012

This has been the case with dxl for as long as I have been using it.
I always wrap functions in brackets to avoid this:

print((excludeAdmins("ppandit1")) "\n")

 


I guess the designers of dxl poorly implemented the optional brackets causing this mess.
Making them optional makes no sense to me. I suppose they whanted to mak it 'easier than c' so non-programmers could script it.
Now both programmers and non-programmers end up with hard to spot errors.
The designers of dxl really screwed this up!

Optional Brackets: What is this:

 

 

print foo bar "\n"



is foo a function or a variable?
is bar a function or a variable?
if foo is a function, how many arguments does it have?
if bar is a function, how many arguments does it have?
if foo is a function with 1 argument, what is passed to it?

same questions apply to "print", but we all know that one

Functions must have Brackets: What is this:



 

 

print(foo bar "\n")// foo and bar are variables
print(foo(bar "\n"))// foo is a function with 1 arg and bar is a variable
print(foo(bar(), "\n"))// foo is a function with 2 args and bar is a function with 0 args

 

Thank you very much.

Re: Skip list find function does not work
llandale - Tue Oct 16 13:40:59 EDT 2012

SystemAdmin - Tue Oct 16 04:27:40 EDT 2012

Tested this on DOORS 9.4.0.1 and on this version it seems that the DOORS parser reads the line
 

print excludeAdmins ("ppandit1") "\n"

 

as

 

 

print excludeAdmins ("ppandit1\n")



which comes back as false. I removed the "\n" from the line at it worked fine (result was true).



 

 

 

  • Pekka Mäkinen - http://www.softqa.eu/

 

yes. This comes up with functions that have a single string parameter. The parenthesis are ignored. While 99% of the world views this as a "bug"; some others view it as a "feature". So yes, try this
  • print (excludeAdmins ("ppandit1")) "\n"

-Louie